<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8">
		<title>修改页面</title>
		<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
	</head>
	<body>
		<form class="layui-form" action="">
			<div class="mainBox">
        <div class="main-container">
          <div class="layui-form-item">
          <label class="layui-form-label">原密码</label>
            <div class="layui-input-inline">
              <input type="password" name="oldPassword" lay-verify="required" lay-verType="tips" placeholder="请输入原密码" class="layui-input">
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">新密码</label>
            <div class="layui-input-inline">
              <input type="password" name="password" lay-verify="pass" lay-verType="tips" autocomplete="off"  placeholder="新密码6-16位字符" class="layui-input">
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">确认密码</label>
            <div class="layui-input-inline">
              <input type="password" name="repassword" lay-verify="repass" lay-verType="tips" autocomplete="off"   placeholder="再次确认密码" class="layui-input">
            </div>
          </div>
        </div>
      </div>
      <div class="bottom">
        <div class="button-container">
          <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
            lay-filter="userpass-save">
            <i class="layui-icon layui-icon-ok"></i>
            提交
          </button>
          <button type="reset" class="pear-btn pear-btn-sm">
            <i class="layui-icon layui-icon-refresh"></i>
            重置
          </button>
        </div>
      </div>
    </form>
  <script src="/static/component/layui/layui.js"></script>
  <script src="/static/component/pear/pear.js"></script>

  <script>
    layui.use(['form', 'jquery'], function() {
      let form = layui.form;
      let $ = layui.jquery;

      form.on('submit(userpass-save)', function(data) {
        $.ajax({
          url: "{:url('system.Admin/repassSet')}",
          data: JSON.stringify(data.field),
          dataType: 'json',
          contentType: 'application/json',
          type: 'post',
          success: function(result) {
            if (result.code === 0) {
              layer.msg(result.msg, {
                icon: 1,
                time: 1000
              }, function() {
                parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
              });
            } else {
              layer.msg(result.msg, {
                icon: 2,
                time: 1000
              });
            }
          }
        })
        return false;
      });

    })
  </script>
</body>
</html>